#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "pwm.h"
uint8_t i;	
int main(void)
{
	/*OLED初始化*/
	OLED_Init();
	PWM_Init();
//	TIM3_PWM_Init(899,0);
//	PWM_SetCompare3(50);
	while (1)
	{
		for (i = 0; i <= 100; i++)
		{
			PWM_SetCompare2(i);			//依次将定时器的CCR寄存器设置为0~100，PWM占空比逐渐增大，LED逐渐变亮
			Delay_ms(10);				//延时10ms
		}
		for (i = 0; i <= 100; i++)
		{
			PWM_SetCompare2(100 - i);	//依次将定时器的CCR寄存器设置为100~0，PWM占空比逐渐减小，LED逐渐变暗
			Delay_ms(10);				//延时10ms
		}
	}
	
	return 0;
}
